import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DeviceVersionVO, DeviceVersionForm, DeviceVersionQuery } from '@/api/device/deviceVersion/types';

/**
 * 查询设备升级信息列表
 * @param query
 * @returns {*}
 */

export const listDeviceVersion = (query?: DeviceVersionQuery): AxiosPromise<DeviceVersionVO[]> => {
  return request({
    url: '/device/deviceVersion/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备升级信息详细
 * @param deviceVersionId
 */
export const getDeviceVersion = (deviceVersionId: string | number): AxiosPromise<DeviceVersionVO> => {
  return request({
    url: '/device/deviceVersion/' + deviceVersionId,
    method: 'get'
  });
};

/**
 * 新增设备升级信息
 * @param data
 */
export const addDeviceVersion = (data: DeviceVersionForm) => {
  return request({
    url: '/device/deviceVersion',
    method: 'post',
    data: data
  });
};
/**
 * 新增设备升级信息
 * @param data
 */
export const pushVersionUpdate = () => {
  return request({
    url: '/device/deviceVersion/pushVersionUpdate',
    method: 'post',
  });
};

/**
 * 修改设备升级信息
 * @param data
 */
export const updateDeviceVersion = (data: DeviceVersionForm) => {
  return request({
    url: '/device/deviceVersion',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备升级信息
 * @param deviceVersionId
 */
export const delDeviceVersion = (deviceVersionId: string | number | Array<string | number>) => {
  return request({
    url: '/device/deviceVersion/' + deviceVersionId,
    method: 'delete'
  });
};
